package org.monitor.servlet.pairs;

public class PairsBuilder {
	
	private Pairs pairs;
	
	private PairsBuilder(){
		pairs = new Pairs();
	}
	
	private PairsBuilder(Pairs pairs){
		this.pairs = pairs;
	}

	public static PairsBuilder create(){
		return create(null);
	}
	
	public static PairsBuilder create(Pairs pairs) {
		PairsBuilder builder = null;
		if(pairs != null){
			builder = new PairsBuilder(pairs.clone());
		}else {
			builder = new PairsBuilder();
		}
		
		return builder;
	}
	
	public void addPair(String name, String value){
		pairs.addPair(name, value);
	}
	
	public void addFile(String filename, String filePath){
		pairs.addFile(filename, filePath);
	}
	
	public void setPostData(byte[] postData){
		pairs.setPostData(postData);
	}

	public Pairs build() {
		return pairs;
	}

}
